-- town1 - "The Capital"

function autoexec()
  --set_progress(P_EARLYPROGRESS, 1);
--  refresh()
end

function refresh()
  return
end
function postexec()
  return
end

function zone_handler(zn)
  if (zn == 1) then
    door_in("a_e")

  elseif (zn == 2) then
    door_in("d_e")

  elseif (zn == 3) then
    door_in("inn_we")

  elseif (zn == 4) then
    door_in("inn_ee")

  elseif (zn == 5) then
    door_in("w_e")

  elseif (zn == 6) then
    --statue

  elseif (zn == 7) then
    thought(HERO1,"Why should I climb over the wall when I can walk through the gate?");

  elseif (zn == 8) then
    thought(HERO1,"The guards would see me climb the wall.");

  elseif (zn == 9) then
    thought(HERO1,"You look into the water, and see a reflection of a rather ugly looking hero.");

  elseif (zn == 10) then
    change_map("land","cap_exit");

  elseif (zn == 11) then
    --change_map("castle",20,42,21,42);
    thought(HERO1, "The portcullis is down. I can go no further.");
  elseif (zn == 12) then
    touch_fire(get_pidx(0));

  elseif (zn == 13) then
    door_out("a_x")

  elseif (zn == 14) then

  elseif (zn == 15) then

  elseif (zn == 16) then
    shop(10);

  elseif (zn == 17) then
    shop(21);

  elseif (zn == 18) then

  elseif (zn == 19) then
    door_out("d_x")

  elseif (zn == 20) then
    door_out("w_x")

  elseif (zn == 21) then
    shop(11);

  elseif (zn == 22) then
    door_out("inn_wx")

  elseif (zn == 23) then
    door_out("inn_ex")

  elseif (zn == 24) then
    inn("The Royal Inn",25,3); 

  elseif (zn == 26) then
    door_out("inn_nx") 

  elseif (zn == 27) then
    if (get_progress(P_TUNNEL) == 0) then 
      thought(HERO1,"It appears to be an empty rain barrel.");  
    else	
      thought(HERO1,"You check if anyone is watching, and then jump in the barrel.");
      change_map("tunnel","tun_enter")  -- tunnel entrance to rebel HQ
      set_progress(P_TUNNEl,2)
    end    
  
  elseif (zn == 28) then
    door_in("inn_ne")

  elseif (zn == 29) then
    door_in("courtyard_x")
  
  elseif (zn == 30) then
    door_out("courtyard_e")
  
  elseif (zn == 31) then
    if ((get_progress(P_QUEST1) == 7) and (get_progress(P_TUNNEL) == 0)) then
      set_progress(P_CARAVEL,1)
      bubble(HERO2,"How have you been Alured?");
      bubble(11,"Good, good.");
      bubble(HERO2,"We came because we accomplished our mission.");
      bubble(11,"Quiet down. Be cautious now, there are other folk about.");
      msg("The bartender leans over the counter and whispers", 255, 0);
      bubble(11,"Was what you found missing a piece?");
      bubble(HERO1,"Yeah just a half a ...?");
      bubble(en,"Well our friends found where the other half is. Go to Grimsby and take a boat to the Island of Thessalia");
      bubble(en,"You'll find the residents different but friendly. The other peice should be in the shrine on the island.");
      bubble(en,"Bring it back here.");
    
    elseif ((get_progress(P_QUEST1) == 8) and (get_progress(P_TUNNEL) == 0)) then
      bubble(HERO1,"It wasn't pretty but we got what we went for.");
      bubble(en,"Go out back into the courtyard. There is a rain barrel out there that has a false bottom. Go take a look.");
      set_progress(P_TUNNEL,1); 
      
    else
      inn("The Roasted Boar Inn",75,9);
    end
 
  elseif (zn == 32) then
    change_map("land","cap_exitw")  
 
  elseif (zn == 33) then
    thought(HERO1,"A painting of the Fires of Westin. It's a depiction of a battle where Fiebraes, my father, the Mage General of Diduma called fire down upon the enemies of Diduma."); 
  
end

function entity_handler(en)
  if (en == 0) then
    bubble(0,"Where is that boy?!");
    bubble(HERO1,"What boy?");
    bubble(0,"My assistant gardener, he has gone missing again.");

  elseif (en == 1) then
    bubble(1,"Grunt");

  elseif (en == 2) then
    bubble(2,"Grunt");

  elseif (en == 3) then
    bubble(3,"I've never been to the capital before.");
    bubble(3,"Isnt it grand?");

  elseif (en == 4) then
    bubble(en,"Dont tell the gardener, but I'm on a lunch break.");

  elseif (en == 5) then
    bubble(5,"The shopkeeper is such a sweetie.");

  elseif (en == 8) then
    bubble(8,"I'm the supplier for this here armoury.");
    bubble(8,"You should take a look around.");

  elseif (en == 9) then
    bubble(9,"Can't you see I'm busy right now?");

  elseif (en == 12) then
    if (prompt(en,2,0,"Did you see my sister out there?","  yes","  no","") == 0) then
    bubble(en,"She's so... annoying some times.");
    else
    bubble(en,"Well you probably don't want to meet her anyways.");
    end

  elseif (en == 13) then
    bubble(en,"Did you know that I'm one of Golerak's suppliers?");

  elseif (en == 14) then
    bubble(14,"I love shopping here.");
    bubble(14,"There is always something good here to buy.");

end
end
end

